#include <windows.h>

//------------------------------------------------------------------------
inline
SafeCounter::SafeCounter()
:m_value(0)
{

}

//------------------------------------------------------------------------
inline
SafeCounter::SafeCounter(int value)
:m_value(value)
{

}

//------------------------------------------------------------------------
inline
SafeCounter::~SafeCounter()
{

}

//------------------------------------------------------------------------
inline int
SafeCounter::increment()
{
	return (int)InterlockedIncrement((LONG volatile*)&m_value);		
}

//------------------------------------------------------------------------
inline int
SafeCounter::decrement()
{
	return (int)InterlockedDecrement((LONG volatile*)&m_value);
}

//------------------------------------------------------------------------
inline int
SafeCounter::getValue() const
{
	return m_value;
}

//------------------------------------------------------------------------
inline bool
operator==(const SafeCounter& lhs, const SafeCounter& rhs)
{
	return lhs.m_value==rhs.m_value;
}